<template>
  <div class="navbox">
    <div class="nav common">
      <div class="logo">
        <img src="../../../public/images/logo.svg" alt="" />
        <span>区块链版权存证平台</span>
      </div>
      <div class="navlist">
        <ul>
          <li
            @click="navClick(i)"
            :style="{ color: i.id === navItemSelectedId ? '#0079fe' : '' }"
            v-for="i in navList.list"
            :key="i.id"
          >
            {{ i.name }}
          </li>
        </ul>
      </div>
      <div class="consoles">
        <button @click="toset">控制台</button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { reactive, ref } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const navList = reactive({
  list: [
    { id: 1, name: "首页", path: "/homeview/home" },
    { id: 2, name: "应用场景", path: "/homeview/scene" },
    { id: 3, name: "验证中心", path: "/homeview/proving" },
    { id: 4, name: "帮助与文档", path: "/homeview/help" },
    { id: 5, name: "数据监控大屏", path: "/homeview/monitor" },
  ],
});
const toset = () => {
  router.push("/console");
};
const navItemSelectedId = ref(1);
const navClick = (i) => {
  navItemSelectedId.value = i.id;
  router.push(i.path);
};
</script>

<style lang="less" scoped>
.navbox {
  height: 65px;
  width: 100%;
  background-color: white;
  // line-height: 65px;
  font-size: 15px;
  .nav {
    display: flex;
    height: 100%;
    align-items: center;
    .logo {
      flex: 1;
      img {
        height: 44px;
        width: 44px;
        margin: 0 5px 0 0;
        vertical-align: middle;
      }
      span {
        font-weight: bold;
      }
    }
    .navlist {
      flex: 3;
      ul {
        margin: 0;
        display: flex;
        justify-content: space-around;
        li:hover {
          color: #0079fe;
          cursor: pointer;
        }
      }
    }
    .consoles {
      text-align: right;
      flex: 1;
      button {
        border: 1px solid #0079fe;
        width: 80px;
        height: 35px;
        background-color: transparent;
        color: #0079fe;
        border-radius: 2px;
      }
      button:hover {
        background-color: #0079fe;
        color: white;
        cursor: pointer;
      }
    }
  }
}
</style>